Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display ordered NPC path on map, move TALK_GOTO_LOCATION to top-level menu #74093

Merged
merged 6 commits into from
Jun 26, 2024

Conversation

RenechCDDA
Copy link
Member

@RenechCDDA RenechCDDA commented May 25, 2024

Summary

Balance "Display ordered NPC path on map, NPCs refuse to go to dangerous locations "

Purpose of change

NPC followers are suicidally loyal and hard to keep track of

Camp ( 312, 555, 0) where the heck is that? Dang it I knew I shouldn't have named all of my camps Camp.

Describe the solution

-Display the route automatically at the time of ordering the movement.
--The map automatically pans over the route and pauses at the end

-Move the "TALK_GOTO_LOCATION" topic to the top-level menu, instead of burying it 2 menus deep in a camp topic(?!)

-Display an estimated time of arrival and a query so you know you sent the NPC to the right place

Describe alternatives you've considered

Testing

2024-06-16.08-24-44.mp4

Additional context

Plans for pathfinding changes were pushed out to future PRs, see edit record/followup message

Known issues:
The highlighted red path sometimes does not display on the opened map, depending on when the last blink was shown.
(It will still step through each tile as appropriately, it just won't have a visible trail it's following)

The speed at which it advances through the tiles is rather slow, limited by how often the frames are redrawn rather than the actual code limitations I've applied.
--Moving the mouse causes it to go very fast, because mouse inputs trigger new frames to be drawn.
--Regardless, you can exit the overmap ui at any time, so you don't have to wait to see. But you can.

@github-actions github-actions bot added NPC / Factions NPCs, AI, Speech, Factions, Ownership Info / User Interface Game - player communication, menus, etc. Map / Mapgen Overmap, Mapgen, Map extras, Map display [C++] Changes (can be) made in C++. Previously named `Code` Game: Balance Balancing of (existing) in-game features. json-styled JSON lint passed, label assigned by github actions astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions labels May 25, 2024
@RenechCDDA RenechCDDA force-pushed the overmap_npc_pathfinding_2 branch from eb061f7 to 33c8311 Compare May 29, 2024 01:43
@RenechCDDA
Copy link
Member Author

I'm going to put off changing their actual pathing until a future PR, since I haven't gotten around to it yet. Don't want to have this sit here forever waiting for me to finish something it doesn't need to wait on.

@RenechCDDA RenechCDDA force-pushed the overmap_npc_pathfinding_2 branch from 33c8311 to 255a6a5 Compare June 16, 2024 08:52
@RenechCDDA RenechCDDA force-pushed the overmap_npc_pathfinding_2 branch from 255a6a5 to 06b458d Compare June 16, 2024 11:17
@github-actions github-actions bot added <Documentation> Design documents, internal info, guides and help. Translation I18n [JSON] Changes (can be) made in JSON [Markdown] Markdown issues and PRs [Python] Code made in Python EOC: Effects On Condition Anything concerning Effects On Condition labels Jun 16, 2024
@RenechCDDA RenechCDDA marked this pull request as ready for review June 16, 2024 11:20
@RenechCDDA RenechCDDA changed the title Display ordered NPC path on map, NPCs refuse to go to dangerous locations Display ordered NPC path on map, move TALK_GOTO_LOCATION to top-level menu Jun 16, 2024
+don't overrun our iterators
src/game.h Outdated
@@ -1154,6 +1154,9 @@ class game
// show NPC pathfinding on overmap ui
bool debug_pathfinding = false; // NOLINT(cata-serialize)

//Ugly kludge to pass info to tile overmaps
npc *follower_path_to_show = nullptr;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really don't like this but the only alternative I see is passing display_path into a long chain of functions to get it to show up for tile overmaps.

@@ -689,6 +690,11 @@ static void draw_ascii(
npc *npc_to_add = npc_to_get.get();
followers.push_back( npc_to_add );
}
if( !display_path.empty() ) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because this is technically passed different data than the tile overmaps, future changes could accidentally knock them out of sync.

It would be ideal to NOT have these be different, but the kludge in game.h is not something I want to rely on. That is why they are still different. But having them be different at all is another problem...

@RenechCDDA RenechCDDA force-pushed the overmap_npc_pathfinding_2 branch from 2b43a7c to 0d6eb29 Compare June 16, 2024 23:18
@Maleclypse
Copy link
Member

Are you waiting on reviews for this or is this ready for merge?

@RenechCDDA
Copy link
Member Author

RenechCDDA commented Jun 18, 2024

It'd be nice if someone had a better way to handle the stuff I've commented on, but otherwise it's good to go. Not a hard requirement, IMO

@dseguin dseguin merged commit 8ed7912 into CleverRaven:master Jun 26, 2024
28 checks passed
@RenechCDDA RenechCDDA deleted the overmap_npc_pathfinding_2 branch June 26, 2024 13:57
@RenechCDDA
Copy link
Member Author

Oops, I forgot to edit the changelog line. Uh, hopefully one of us can catch that in the weekly changelog before it gets merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions [C++] Changes (can be) made in C++. Previously named `Code` <Documentation> Design documents, internal info, guides and help. EOC: Effects On Condition Anything concerning Effects On Condition Game: Balance Balancing of (existing) in-game features. Info / User Interface Game - player communication, menus, etc. [JSON] Changes (can be) made in JSON json-styled JSON lint passed, label assigned by github actions Map / Mapgen Overmap, Mapgen, Map extras, Map display [Markdown] Markdown issues and PRs NPC / Factions NPCs, AI, Speech, Factions, Ownership [Python] Code made in Python Translation I18n
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants